﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace JTTD.Common.Helper
{
    public static class StringHelper
    {
        public static void AddLgoToTXT(string logstring)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory + "//jjtdlogs//";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string sFileName = path + "\\" + string.Format("{0}.log", DateTime.Now.ToString("yyyy-MM-dd"));
            string sContent = string.Format("{0}-- {1}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), logstring);
            FileStream fs = new FileStream(sFileName, FileMode.Append);
            Byte[] b = Encoding.Default.GetBytes(sContent);
            fs.Write(b, 0, b.Length);
            fs.Close();
        }
    }
}
